/**
 * 
 */
package org.jpxx.workflow;

/**
 * <p>
 * An WorkFlow model is represented as a directed graph with a set of
 * constraints. A directed graph consists of nodes and transitions between
 * nodes. An XFlow graph has the following types of nodes: <code>Start</code>
 * <code>End</code> <code>Process</code> <code>And</code> <code>Or</code>
 * <code>Container</code>
 * <p>
 * 
 * @author John Lee
 * 
 */
public enum NodeType {

	/**
	 * A Process node indicates the name of an application or an application
	 * component that will perform processing on a work-item.
	 */
	PROCESS("Process"),

	/**
	 * An And node is used to synchronize two or more parallel flows that
	 * transition into it.
	 */
	AND("And"),

	/**
	 * An Or node is used in the case where a flow should continue when any one
	 * of its incoming nodes transitions into it.
	 */
	OR("Or"),

	/**
	 * A Start node is simply an indicator to denote where a workflow starts.
	 * Start and End nodes do not do any processing – they are simply markers
	 * used by the workflow engine.
	 */
	START("Start"),

	/**
	 * Similarly an End node indicates where a workflow ends. Start and End
	 * nodes do not do any processing – they are simply markers used by the
	 * workflow engine.
	 */
	END("End"),

	/**
	 * A Container node contains the name of another WorkFlow model – it is in
	 * fact a sub-workflow. Container nodes are useful as a means of hiding
	 * sub-workflows within the larger workflow. Container workflows may execute
	 * within the main thread or be spawned off as a separate workflow instance.
	 * A container node that has a transition out of it executes within the
	 * thread. A container node that has no transition out of it executes as a
	 * separate thread (i.e. a new workflow instance is created).
	 */
	CONTAINER("Container");

	private String type;

	private NodeType(String type) {
		this.setType(type);
	}

	/**
	 * @param type
	 *            the type to set
	 */
	public final void setType(String type) {
		this.type = type;
	}

	/**
	 * @return the type
	 */
	public final String getType() {
		return type;
	}

}
